import { Injectable } from '@nestjs/common';
import ConfigManager from './ConfigManager';

@Injectable()
export class AppService {
    getHello(): string {
        return 'Hello World!';
    }

    postData(data: any) {
        const time = data.time as number;
        // 判断time是否为数字
        if (typeof time !== 'number') {
            return {
                code: 0,
                message: '参数错误',
            }
        }
        return {
            code: 1,
            message: '成功',
            data: time
        };
    }

    loadConfig(data: any) {
        const configs = ConfigManager.getTestUniversalConfigs();
        return {
            code: 1,
            message: '成功',
            data: configs
        };
    }
}
